package com.power.config;

import com.mongodb.MongoClientURI;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;

/**
 * ClassName:AbstractMongoConfig
 * Package:com.abrs.config
 * Description:
 *
 * @date:2019/12/17 17:18
 * @author:zhangqiang
 */
public abstract class AbstractMongoConfig {

    public MongoDbFactory mongoDbFactory(String uri) throws Exception {
        return new SimpleMongoDbFactory(new MongoClientURI(uri));
    }

    public abstract MongoTemplate getMongoTemplate() throws Exception;
}

